<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>Form Elements - Ace Admin</title>

<meta name="description" content="Common form elements and layouts" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<!-- bootstrap & fontawesome -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/font-awesome.min.css" />

<!-- page specific plugin styles -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/chosen.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/daterangepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/bootstrap-colorpicker.min.css" />


<!-- ace styles -->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace.min.css"
	id="main-ace-style" />

<!--[if lte IE 9]>
			<link rel="stylesheet" href="<%=request.getContextPath()%>/ace/assets/css/ace-part2.min.css" />
		<![endif]-->
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace-skins.min.css" />
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/ace/assets/css/ace-rtl.min.css" />

<!--[if lte IE 9]>
		  <link rel="stylesheet" href="<%=request.getContextPath()%>/ace/assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- inline styles related to this page -->

<!-- ace settings handler -->
<script
	src="<%=request.getContextPath()%>/ace/assets/js/ace-extra.min.js"></script>

<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

<!--[if lte IE 8]>
		<script src="<%=request.getContextPath()%>/ace/assets/js/html5shiv.min.js"></script>
		<script src="<%=request.getContextPath()%>/ace/assets/js/respond.min.js"></script>
		<![endif]-->
<link rel="stylesheet" href="<%=request.getContextPath()%>/static/jquery-validate/css/form.css" />
</head>

<body class="no-skin">

	<!-- /section:basics/content.breadcrumbs -->
	<div class="page-content">
		<!-- /section:settings.box -->
		<div class="page-content-area">
			<div class="page-header">
				<h1>
					会计科目编辑
				</h1>
			</div>
			<!-- /.page-header -->

			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<form id="drizzt-table" class="form-horizontal"
						action="<%=request.getContextPath()%>/bsbAccounting/update.do"
						method="post">
						<!-- #section:elements.form -->
								<input type="hidden"   name="id" value="${bsbAccounting.id}"
									class="col-xs-10 col-sm-5" />
								<input type="hidden" name="queryString" value="${queryString}">
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										for="form-field-1"> 科目名称 </label>
		
									<div class="col-sm-9">
										<input type="text"   placeholder="name"
											name="name" value="${bsbAccounting.name}"
											class="col-xs-10 col-sm-5" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										for="form-field-1"> 适用范围 </label>
		
									<div class="col-sm-9">
										<input type="text"   placeholder="scope"
											name="scope" value="${bsbAccounting.scope}"
											class="col-xs-10 col-sm-5" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										for="form-field-1"> 科目编号 </label>
		
									<div class="col-sm-9">
										<input type="text"   placeholder="code"
											name="code" value="${bsbAccounting.code}"
											class="col-xs-10 col-sm-5" />
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										for="form-field-1"> 科目类型 </label>
		
									<div class="col-sm-9">
									<select class="form-control" name="type">
								      <c:forEach items="${types }" var="t">
									      <option value="${t.index }" <c:if test="${bsbAccounting.type==t.index }">selected</c:if> >${t.name}</option>
								      </c:forEach>
								    </select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right"
										for="form-field-1"> 内容 </label>
		
									<div class="col-sm-9">
										<input type="hidden" id="content"  name="content" value='${bsbAccounting.content}'/>
									<div id="wang"></div>
									</div>
								</div>
						<div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<input  class="btn btn-info" id="sub" type="submit" value="提交" />

								&nbsp; &nbsp; &nbsp;
								<input  class="btn btn-info" type="button" onclick="history.go(-1)" value="返回" />
							</div>
						</div>
					</form>

					<!-- PAGE CONTENT ENDS -->
				</div>
				<!-- /.col -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.page-content-area -->
	</div>
	<!-- /.page-content -->
</body>

<!-- basic scripts -->

<!--[if !IE]> -->
<script type="text/javascript">
	window.jQuery
			|| document
					.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery.min.js'>"
							+ "<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery1x.min.js'>"+"<"+"/script>");
</script>
<![endif]-->
<script type="text/javascript">
	if ('ontouchstart' in document.documentElement)
		document.write("<script src='<%=request.getContextPath()%>/ace/assets/js/jquery.mobile.custom.min.js'>"+ "<"+"/script>");
</script>

<script
	src="<%=request.getContextPath()%>/ace/assets/js/bootstrap.min.js"></script>

<script src="<%=request.getContextPath()%>/static/jquery-validate/js/jquery.validate.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/jquery-validate/js/jquery.validate.extend.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/static/jquery-validate/js/additional-methods.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/ace/assets/js/bootbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/js/wangEditor.js"></script>
<script type='text/javascript'>
	var E = window.wangEditor
	
	var editor1 = new E('#wang')
	editor1.customConfig.uploadImgShowBase64 = true
	editor1.customConfig.pasteIgnoreImg = true
	editor1.create()
	editor1.txt.html($("#content").val());
</script>
<script type="text/javascript">
	  $().ready(function() {
		  $("#drizzt-table").validate({
		    rules: {
		    	 name : {
		             required : true,
		             maxlength:50
		         },
		         scope:{
		        	 maxlength:50
		         },
		         code : {
		        	 required : true,
		        	 digits:true,
		        	 rangelength:[4,4],
		        	 isCode : true
		         },
		         content:{
		        	 required : true
		         }
		   },
		   messages :{
		    	 name : {
		             required : "科目名称不能为空",
		             maxlength:"不能超过50个字符"
		         },
		         scope:{
		        	 maxlength:"不能超过50个字符"
		         },
		         code : {
		        	 required : "科目编号不能为空",
		        	 digits:"只能输入数字",
		        	 rangelength:"长度为4位",
		        	 isCode : "编码第一位不能是0"
		         },
		         content : {
		        	 required : "内容不能为空"
		         }
		   },
			  
			submitHandler: function(form) {
				var txt = '';
				$("#content").val(editor1.txt.html());
				txt = $("#content").val(); 
				if(txt == '<p><br></p>' || txt==''){
					bootbox.alert("请填写内容");
					return false;
				}
				$("#sub").attr("disabled","true");
				form.submit();
			   }
		     });
		 });
		//会计科目编码
	  jQuery.validator.addMethod("isCode", function(value, element) {
	      var length = value.length;
	      var mobile = /^([1-9][0-9]{3})$/;
	      return this.optional(element) || (length == 4 && mobile.test(value));
	  }, "编码第一位不能是0");
</script>
</html>
